<!--
 * @FilePath     : /study_code/vue2.x/render-jsx.html
 * @Description  : 冗长代码普通实现
 * @Date         : 2025-05-03 09:58:45
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-05-03 10:00:00
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="" />
  </head>
  <body>
    <div id="app">
      <anchored-heading :level="4">
        <a name="hello-world" href="#hello-world">Hello world!</a>
      </anchored-heading>
    </div>

    <script src="/vue/dist/vue.min.js"></script>
    <script src="./common.js"></script>

    <script type="text/x-template" id="anchored-heading-template">
      <h1 v-if="level === 1">
        <slot></slot>
      </h1>
      <h2 v-else-if="level === 2">
        <slot></slot>
      </h2>
      <h3 v-else-if="level === 3">
        <slot></slot>
      </h3>
      <h4 v-else-if="level === 4">
        <slot></slot>
      </h4>
      <h5 v-else-if="level === 5">
        <slot></slot>
      </h5>
      <h6 v-else-if="level === 6">
        <slot></slot>
      </h6>
    </script>

    <script>
      Vue.component('anchored-heading', {
        template: '#anchored-heading-template',
        props: {
          level: {
            type: Number,
            required: true,
          },
        },
      })

      var app = new Vue({
        el: '#app',
        data: function () {
          return {}
        },
      })
    </script>
  </body>
</html>
